#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
@file_name: running_multiple_tasks_concurrency.py
@date: 2025-07-23 16:50
@author: Falling Snow
@desc: 并发运行多任务
"""

import asyncio
import time

from util import delay


async def main():
    start = time.time()
    sleep_for_three = asyncio.create_task(delay(3))
    sleep_again = asyncio.create_task(delay(3))
    sleep_one_more_time = asyncio.create_task(delay(3))

    await sleep_for_three
    await sleep_again
    await sleep_one_more_time
    end = time.time()

    print(f"执行耗时: {end - start:.4f}")


if __name__ == '__main__':
    asyncio.run(main())
